import request from "@/utils/request"
import apiConfig from "@/utils/apiConfig"

const {addCate,queryCate,updateCate}=apiConfig.api

export default class Cate{
    static addCate(apiData){
        return request(addCate,apiData,'post')
        .then(
            (result)=>{
                return result?result.data:result
            }
        )
    }
    static getCateList(apiData={}){
        let {limit,start,order,sort}=apiData
        return request(`${queryCate}/${limit}/${start}/${order}/${sort}/complex`,{},'get')
        .then(
            (result)=>{
                return result?result.data&&result.data.content:{}
            }
        )
    }
    static updateCate(apiData){
        return request(updateCate,apiData,'put')
        .then(
            (result)=>{
                return result?result.data:{}
            }
        )
    }
}